//gcc -o Thread_Basic Thread_Basic.c -lwiringPi


#include <stdio.h>
#include <wiringPi.h>

#define LED 8

PI_THREAD(Thread1)
{
	(void)piHiPri (10) ;	// Set this thread to be high priority

	for (;;)
	{
		printf("1"); fflush(stdout);
		delay(500);
	}
}

PI_THREAD(Thread2)
{
	(void)piHiPri (10) ;	// Set this thread to be high priority

	for (;;)
	{
		printf("2"); fflush(stdout);
		delay(1000);
	}
}

void setup (void)
{
	wiringPiSetup();
	piThreadCreate(Thread1);
	piThreadCreate(Thread2);
}

int main (void)
{
	printf("\n Start...\n"); fflush(stdout);
	setup();
	for (;;)
	{
		printf("m"); fflush(stdout);
		delay (2000);
	}
	return 0 ;
}
